Back to course home
0% completed
Vote For New Content
Oracle Hard
Integer to English Words (hard)
Solution: Integer to English Words
Trapping Rain Water (hard)
Solution: Trapping Rain Water
First Missing Positive (hard)
Solution: First Missing Positive
Merge K Sorted Lists (hard)
Solution: Merge K Sorted Lists
Max Points on a Line (hard)
Solution: Max Points on a Line
Sudoku Solver (hard)
Solution: Sudoku Solver
Longest Valid Parentheses (hard)
Solution: Longest Valid Parentheses
Remove Nth Node From End of List (Medium)
Solution: Remove Nth Node From End of List
Median of Two Sorted Arrays (hard)
Solution: Median of Two Sorted Arrays
Constrained Subsequence Sum (hard)
Solution: Constrained Subsequence Sum
3Sum (medium)
Problem Statement
Given an array of unsorted numbers, find all unique triplets in it that add up to zero.
Examples
Example 1
- Input: [-3, 0, 1, 2, -1, 1, -2]
- Output: [[-3, 1, 2], [-2, 0, 2], [-2, 1, 1], [-1, 0, 1]]
- Explanation: There are four unique triplets whose sum is equal to zero.
Example 2
- Input: [-5, 2, -1, -2, 3]
- Output: [[-5, 2, 3], [-2, -1, 3]]
- Explanation: There are two unique triplets whose sum is equal to zero.
Constraints:
3 <= arr.length <= 3000- -105 <= arr[i] <= 105
Try it yourself
Try solving this question here:
Java
. . . .
Solution: Container With Most Water
Solution: 3Sum
Mark as Completed
On this page
Problem Statement
Examples
Example 2
Try it yourself